package cn.iocoder.yudao.module.mqtt.dal.mysql.devicelatestlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mqtt.dal.dataobject.devicelatestlog.DeviceLatestLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mqtt.controller.admin.devicelatestlog.vo.*;

/**
 * 数据上传 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DeviceLatestLogMapper extends BaseMapperX<DeviceLatestLogDO> {

    default PageResult<DeviceLatestLogDO> selectPage(DeviceLatestLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceLatestLogDO>()
                .eqIfPresent(DeviceLatestLogDO::getDeviceId, reqVO.getDeviceId())
                .likeIfPresent(DeviceLatestLogDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(DeviceLatestLogDO::getDeviceKey, reqVO.getDeviceKey())
                .eqIfPresent(DeviceLatestLogDO::getGatewayId, reqVO.getGatewayId())
                .eqIfPresent(DeviceLatestLogDO::getRequestType, reqVO.getRequestType())
                .eqIfPresent(DeviceLatestLogDO::getRequestBody, reqVO.getRequestBody())
                .eqIfPresent(DeviceLatestLogDO::getResponseBody, reqVO.getResponseBody())
                .eqIfPresent(DeviceLatestLogDO::getSendStatus, reqVO.getSendStatus())
                .eqIfPresent(DeviceLatestLogDO::getResponseStatus, reqVO.getResponseStatus())
                .betweenIfPresent(DeviceLatestLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceLatestLogDO::getId));
    }

}